000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. LOGGER.
       AUTHOR. GROEP 28.
       AUTHOR. MICHEL GRYP.
       AUTHOR. MICHAEL HEUGHEBAERT.
       AUTHOR. MATTHIAS REYNAERT.
       
       ENVIRONMENT DIVISION.
       SELECT LOGGER ASSIGN TO "Logfile.txt"
              ORGANIZATION IS LINE SEQUENTIAL.
              
       DATA DIVISION.
       FILE SECTION.
       FD LOGGER.
       COPY LOGLAYOUTCOPY.
       
       WORKING-STORAGE SECTION.
       01 WS-LOGMESSAGE         PIC X(200).
       
       LINKAGE SECTION.
       COPY LOGHELPERCOPY.
       COPY OPENCLOSECOPY.
       
       PROCEDURE DIVISION USING LOGLINE, OPENCLOSE.
       PGM.
       
       IF OPENCONNECTION
         PERFORM STARTUP
       END-IF
       
       PERFORM WRITELOGLINE
         
       IF CLOSECONNECTION
         PERFORM SHUTDOWN
       END-IF
       
       EXIT PROGRAM.
       
       STARTUP.
       OPEN OUTPUT LOGGER
       
       WRITELOGLINE.
       INITIALIZE WS-LOGMESSAGE
       MOVE CURRENT-DATE TO TS-CURRENT-DATE
       MOVE CURRENT-TIME TO TS-CURRENT-TIME

       STRING LOGPROGRAM DELIMITED BY "*", " - ",
              LOGMESSAGE DELIMITED BY "*" 
              INTO WS-LOGMESSAGE
       END-STRING
       
       MOVE WS-LOGMESSAGE TO L-MESSAGE
       
       WRITE L-LINE
       
       SHUTDOWN.
       CLOSE LOGGER